
const https = require("https");

const postData = JSON.stringify({
    grant_type: 'client_credential',
    appid: 'wxecc9322469a3f41b',
    secret: '7803a7c5261cd59ce2fcc64b7d212b4f',
    force_refresh: false
});
const options = {
    hostname: 'api.weixin.qq.com',
    port: 443,
    path: '/cgi-bin/stable_token',
    method: 'POST',
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
        'Content-Length': Buffer.byteLength(postData)
    }
};


const req = https.request(options, (res) => {
    let data = '';
  
    res.on('data', (chunk) => {
      data += chunk;
    });
  
    res.on('end', () => {
      console.log('Response:', data);
    });
  });
  
  req.on('error', (error) => {
    console.error('Error:', error);
  });
  
  // 发送POST数据
  req.write(postData);
  req.end();


